# php develop env - A base ubuntu 18
#
#  you can install any version of php , also can always keep pace with the lastest app updates.
# origin ubuntu image (deb)binary install all app
#
FROM ubuntu:18.04

LABEL maintainer="Markway<ljwnet163@163.com>" version="php73.201.beta" license="MIT"

ARG timezone

ENV PHP_V=7.3 \
    APP_ENV=prod \
    # 时区
    TIMEZONE=${timezone:-"Asia/Shanghai"} \
    DEBIAN_FRONTEND=noninteractive
WORKDIR /tmp/deb
RUN set -ex && \
    apt update && \
    # 前置工具
    apt install -y apt-utils ca-certificates && \
    # 换阿里的源(可选)
    cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
    sed -i 's/http\:\/\/archive\.ubuntu\.com/https:\/\/mirrors\.aliyun\.com/g' /etc/apt/sources.list && \
    # 更新源列表 (必须de)
    apt update && \
    apt install -y apt-transport-https tzdata && \
    ln -fs /usr/share/zoneinfo/PRC /etc/localtime && \
    dpkg-reconfigure -f noninteractive tzdata && \
    # 更新应用 (可选)
    # apt upgrade -y && \
    # app编译安装相关
    apt install -y libtool software-properties-common && \
    # repo add
    add-apt-repository ppa:ondrej/php && \
    # add-apt-repository ppa:chris-lea/redis-server && \
    apt update && \
    # php
    apt install -y php$PHP_V \
    php$PHP_V-fpm \
    php$PHP_V-dev \
    php$PHP_V-curl \
    php$PHP_V-gd \
    php$PHP_V-mysql \
    php$PHP_V-mbstring \
    php$PHP_V-xml \
    php$PHP_V-bcmath \
    php$PHP_V-opcache \
    php$PHP_V-zip \
    composer && \
    #apt install -y php-pear && \
    #pecl install swoole
    composer --version
WORKDIR /tmp/script
    # socket改成端口
COPY ./script /tmp
# RUN  chmod 755 /tmp/script/*
#     bash /tmp/script/cnf.sh && \
#     service php$PHP_V-fpm restart && \
#     service php$PHP_V-fpm enable && \
#     service php$PHP_V-fpm status

# EXPOSE $PHP_LISTEN_PORT
#ENTRYPOINT ["service","php$PHP_V-fpm","enable"]


